Skip to content

feat: add custom batch-sizing to cli options#200

Open
troyxmccall wants to merge 1 commit into
JamieMason:mainfrom
troyxmccall:batch-size-option
Open

feat: add custom batch-sizing to cli options#200
troyxmccall wants to merge 1 commit into
JamieMason:mainfrom
troyxmccall:batch-size-option

Conversation

@troyxmccall

@troyxmccall troyxmccall commented Nov 26, 2023

Copy link
Copy Markdown

Description (What)

added option for declaring custom batch sizes, ie: --batch-size 5 , if no option is specified, the batch defaults to the original 300 count

Justification (Why)

Older hardware experiences a regression of #173

❯ imageoptim -V
3.1.9
❯ imageoptim .
i Running ImageOptim...
! stderr maxBuffer length exceeded

! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues

    RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stderr maxBuffer length exceeded
        at new NodeError (node:internal/errors:388:5)
        at Socket.onChildStderr (node:child_process:476:14)
        at Socket.emit (node:events:537:28)
        at addChunk (node:internal/streams/readable:324:12)
        at readableAddChunk (node:internal/streams/readable:293:11)
        at Readable.push (node:internal/streams/readable:234:10)
        at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)

on

❯ neofetch 
                    'c.          admin@mac-mini.local 
                 ,xNMM.          ---------------------- 
               .OMMMMo           OS: macOS 12.7.1 21G920 x86_64 
               OMMM0,            Host: Macmini7,1 
     .;loddo:' loolloddol;.      Kernel: 21.6.0 
   cKMMMMMMMMMMNWMMMMMMMMMM0:    Uptime: 5 hours, 3 mins 
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Packages: 185 (brew) 
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: bash 5.2.21 
;MMMMMMMMMMMMMMMMMMMMMMMM:       Resolution: 1920x1080 
:MMMMMMMMMMMMMMMMMMMMMMMM:       DE: Aqua 
.MMMMMMMMMMMMMMMMMMMMMMMMX.      WM: Quartz Compositor 
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    WM Theme: Blue (Dark) 
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   Terminal: Apple_Terminal 
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   Terminal Font: SFMono-Regular 
    kMMMMMMMMMMMMMMMMMMMMMMd     CPU: Intel i5-4278U (4) @ 2.60GHz 
     ;KMMMMMMMWXXWMMMMMMMk.      GPU: Intel Iris 
       .cooc,.    .,coo:.        Memory: 5274MiB / 8192MiB 
     

How Can This Be Tested?

  • test custom batch sizes
yarn build
./imageoptim --batch-size 10 ~/path/to/folder/
  • test original settings
./imageoptim ~/path/to/another/folder/

@tobybot

tobybot commented Jun 11, 2026

Copy link
Copy Markdown

Is the project abandoned? Batching would be very helpful, but I see there haven't been any updates since before this pull was opened.

@JamieMason

Copy link
Copy Markdown
Owner

It's alive, I just work full time and have other side projects too. I'd love to return to this soon and make some updates.

@kishan-dhankecha

Copy link
Copy Markdown

Thanks for the confirmation @JamieMason. This PR is a must right now and it seems to be working as well. Can you please merge this one?

@tobybot

tobybot commented Jun 18, 2026

Copy link
Copy Markdown

It's alive, I just work full time and have other side projects too. I'd love to return to this soon and make some updates.

Totally understandable. (And of course, thanks for all your work on this!)

I ended up building the binary from the code with these changes in place, and I ran it on a pile of thousands of images with a batch size of 50, it worked great. Thanks troyxmccall, you saved me the time and effort of making these changes myself, or writing a wrapper script!

@JamieMason

Copy link
Copy Markdown
Owner

Thanks both, I'm not trying to drag my heels I just have 2 other projects I'm working on. I would like to rewrite this in Rust at some point as I've been enjoying that, but I'll try to cut a release this weekend with your changes in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants